#ifndef CNC_SYS_H
#define CNC_SYS_H
#include "cx_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct CNC_Coordinate
{
    int x, y, z;
}CNC_Coordinate_t;

typedef struct CNC_SystemParameters
{
    CNC_Coordinate_t ProgCoordinateOrigin;
    CNC_Coordinate_t System_RefCoordinate;
}CNC_SystemParams_t;

int CNC_UpdateRefCoordinate(CNC_Coordinate_t *pDeltaCoor);
int CNC_GoToCoordinate(CNC_Coordinate_t *pTargetCoord);
void SaveRefCoordinate(void);
void ReadRefCoordinate(void);

extern CNC_Coordinate_t System_RefCoordinate;
extern CNC_Coordinate_t System_ProgCoordinateOrigin;
extern float system_expected_feed;
extern float system_feed_rate;
extern float system_feed_speed;
extern float system_spindle_speed;
extern float system_interplate_period_ms;
extern float system_pulse_equivalent_x;
extern float system_pulse_equivalent_y;
extern float system_pulse_equivalent_z;
int CNC_SetFeedSpeed(float feed);
int CNC_Move(int dx,int dy, int dz);

void TransactorRegister(void (*cb)(int,int,int));
int CNC_SetPulseEquivalent(int axis, float pulse_quivalent_value);
int CNC_SpindleControl(int status);
int CNC_CoolingControl(int status);
int CNC_SetMainshaftSpeed(float speed);
void TransactorRegister(void (*cb)(int,int,int));
void CoolingControlRegister(void (*cb)(int));
void MainshaftControlRegister(void (*cb)(int));
void MainshaftSpeedControlRegister(void (*cb)(float));
void FeedspeedControlRegister(void (*cb)(float));
void extern_INTERPOLATOR_CANCLE(void);
#ifdef __cplusplus
}
#endif
#endif
